package com.android1.amarena2d.test;

import com.android1.amarena2d.actions.base.Action;
import com.android1.amarena2d.actions.interval.Blink;
import com.android1.amarena2d.input.TouchListenerAdapter;
import com.android1.amarena2d.nodes.Scene;
import com.android1.amarena2d.nodes.SimpleLabel;
import com.android1.amarena2d.nodes.sprites.SharedSprite;
import com.badlogic.gdx.graphics.Color;

public class TouchPriorityExampleScene extends Scene {


    Action blink = Blink.$(0.3F, 7);
    Action blink2 = Blink.$(0.3F, 7);

    public TouchPriorityExampleScene() {

        engine.getRenderer().setClearColor(Color.WHITE);

        final SharedSprite map = new SharedSprite("assets/map.png", 0, 0);
        map.touch().makeTouchable(2,new TouchListenerAdapter() {
            @Override
            public boolean onTouchUp(float x, float y, int pointer, boolean isHit) {
                map.action().run(blink);
                return true;
            }
        });


        final SharedSprite cloud1 = new SharedSprite("assets/cloud1.png", 250, 250);
        cloud1.touch().makeTouchable(1,new TouchListenerAdapter() {
            @Override
            public boolean onTouchUp(float x, float y, int pointer, boolean isHit) {
                cloud1.action().run(blink2);
                return true;
            }
        });

        add(map, cloud1);
//        map.transform().setRotation(20);


        add(new SimpleLabel("(Tap map or cloud.)", 100, 20, Color.BLACK));


    }


}